traits to groups
Take the survey at https://forms.gle/8WbaPnWe73YsaZhQ6
import { liveGoogleSheet } from "@jimjamslam/live-google-sheet";
import { aq, op } from "@uwdata/arquero";
surveyResults = liveGoogleSheet(
"https://docs.google.com/spreadsheets/d/e/" +
"2PACX-1vQ2YqQkLeFoCyEFroWLRyaVZt4i4GVb3EZsZ0dZgKDdicwB3eQ7AtEYTPHQaimRHutX3tGE49JQ235f/" +
"pub?gid=1263356727&single=true&output=csv",
15000, 1, 3);
respondentCount = surveyResults.length;countsUsed = aq.from(surveyResults)
.derive({ used: d => op.split(d.interest, ", ") })
.select("used")
.unroll("used")
.groupby("used")
.count()
.derive({ measure: d => "Have used" })
.rename({ used: "tool" })countsWant = aq.from(surveyResults)
.derive({ want: d => op.split(d.familiar, ", ") })
.select("want")
.unroll("want")
.groupby("want")
.count()
.derive({ measure: d => "Want to learn" })
.rename({ want: "tool" })// combine the two counts into one dataset again
// countsAll = [...countsUsed.objects(), ...countsWant.objects()];
plotUsed = Plot.plot({
marks: [
Plot.barY(countsUsed, { x: "tool", y: "count", fill: "tool" }), // Use barY for vertical bars
Plot.ruleY([respondentCount], { stroke: "#ffffff99" }) // Change ruleX to ruleY for the vertical line
],
x: { label: "", tickSize: 0 }, // No ticks on X, or you can adjust as needed
y: { label: "", tickSize: 0 }, // No ticks on Y, or adjust
facet: { data: countsUsed, x: "measure", label: "" },
marginLeft: 140,
style: {
width: 1350,
height: 500,
fontSize: 12,
}
});